#include "sdkconfig.h"
#include <esp_log.h>
#include <driver/i2c_master.h>
#include "I2C1.H"


static const char *TAG = "I2C";

i2c_master_bus_handle_t bus_handle = NULL;

    void InitializeI2C1()
    {
        // Initialize I2C peripheral
        i2c_master_bus_config_t i2c_bus_cfg = {
            .i2c_port = I2C1_NUM,
            .sda_io_num = I2C1_SDA_PIN,
            .scl_io_num = I2C1_SCL_PIN,
            .clk_source = I2C_CLK_SRC_DEFAULT,
            .glitch_ignore_cnt = 7,
            .intr_priority = 0,
            .trans_queue_depth = 0,
            .flags = {
                .enable_internal_pullup = 1,
            },
        };
        ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_cfg, &bus_handle));
        ESP_LOGI(TAG, "i2c总线初始化");

    }